<?php require_once('Connections/local.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_local, $local);
$query_requirements = "SELECT * FROM cert_reqs ORDER BY trn ASC";
$requirements = mysql_query($query_requirements, $local) or die(mysql_error());
$row_requirements = mysql_fetch_assoc($requirements);
$totalRows_requirements = mysql_num_rows($requirements);

mysql_select_db($database_local, $local);
$query_courses = "SELECT title, trn, cert_complete FROM legacy_products WHERE legacy_products.delivery = 'ILT' AND legacy_products.status IN ( 'Active', 'Under development') AND legacy_products.content_source = 'STD'";
$courses = mysql_query($query_courses, $local) or die(mysql_error());
$row_courses = mysql_fetch_assoc($courses);
$totalRows_courses = mysql_num_rows($courses);

mysql_select_db($database_local, $local);
$query_curriculum = "SELECT curriculum FROM legacy_curricula ORDER BY orderid ASC";
$curriculum = mysql_query($query_curriculum, $local) or die(mysql_error());
$row_curriculum = mysql_fetch_assoc($curriculum);
$totalRows_curriculum = mysql_num_rows($curriculum);

mysql_select_db($database_local, $local);
$query_course_cur = "SELECT DISTINCT curriculum FROM legacy_curricula  WHERE      legacy_curricula.curriculum in (SELECT curriculum FROM legacy_products WHERE legacy_products.delivery = 'ILT' AND legacy_products.status IN ( 'Active', 'Under development') AND legacy_products.content_source = 'STD') ORDER BY 1 ASC";
$course_cur = mysql_query($query_course_cur, $local) or die(mysql_error());
$row_course_cur = mysql_fetch_assoc($course_cur);
$totalRows_course_cur = mysql_num_rows($course_cur);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Certification Requirements Editor</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="js/ajax.js"></script>
</head>

<body>
<div id="wraper">
  <div id="header"><img src="images/banner.jpg" /><hr/></div>
  
  <div id="content">
    	<div class="content_filter"">
    	  	Curriculum: 
    	  	<select name="cur" id="cur" onchange="ajaxFunction()">
            	<option value="All">All Products</option>	
				<?php do { ?>
                	<option value="<?php echo $row_course_cur['curriculum']  ?>"><?php echo $row_course_cur['curriculum']  ?></option>
                <?php } while ($row_course_cur = mysql_fetch_assoc($course_cur)); ?> 
            </select>
    	</div>

<!-- Course list -->  
   <div id="course_list">    
		<?php do { ?>
          <div class="content_data">
            <p class="title"><a href="#" onclick="showhide('<?php echo $row_courses['trn']; ?>'); return(false);" ><?php echo $row_courses['trn']; ?> - <?php echo $row_courses['title']; ?></a></p>
          	<div class="cert_date">
          		<?php if ($row_courses['cert_complete'] != '') { 
					echo '<img src="images/completeButton.png"/>' ;
				} ?>
          	</div>
     <!-- cert details data -->      
          
          <div class="cert_details" id="<?php echo $row_courses['trn']; ?>" style="display:none;">
          	<hr/>
            
            <table width="630" border="0">
              
              
              <tr>
                <td width="170">Course Pre-Requisites</td>
                <td width="251">&nbsp;</td>
                <td width="195">&nbsp;</td>
              </tr>
              
              <tr>
                <td>Assessment</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>Instructor Materials</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>Train-the-Trainer</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>WBT</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>Other</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
            
            </table>

          	
          </div>  
    <!-- cert details data -->        
          
          </div>
          

    
    
        <?php } while ($row_courses = mysql_fetch_assoc($courses)); ?>
  </div>
<!-- END course list section --> 
 
  </div>
 
  <div id="sidebar">
    <div id="sidemenu">
    	<h4> Menu </h4>
        <ul>
        	<li>Browse</li>
            <li>Define</li>
        </ul>
    </div>
  </div>

 <div id="footer">
 	<hr />
    Copyright © 2011, Parametric Technology Corporation
 </div>
 
</div>
</body>
</html>
<?php
mysql_free_result($requirements);

mysql_free_result($courses);

mysql_free_result($curriculum);

mysql_free_result($course_cur);
?>
